hysop.backend.device.opencl.opencl_array_backend module¶
- class hysop.backend.device.opencl.opencl_array_backend.OpenClArrayBackend(cl_env=None, queue=None, allocator=None, host_array_backend=None)[source]¶
Bases:
ArrayBackend
Opencl array backend, extending pyopencl.array.Array capabilities.
By default all methods are using the default opencl device (setup during build in hysop.__init__.py and hysop.backend.device.opencl.__init__.py) and an associated default command queue. An OpenClArrayBackend can be created with any context and default queue through an OpenClEnvironment.
See hysop.backend.device.opencl.opencl_tools.get_or_create_opencl_env() for more informations on how to create or get an OpenClEnvironment.
The default allocator is a hysop.backend.device.opencl.opencl_allocator.OpenClImmediateAllocator and the arrays are created within a hysop.core.memory.MemoryPool based on this allocator so that there is no surprise when the array is first used (out of memory).
Initialize and OpenClArrayBackend with OpenCL environment cl_env.
If cl_env and queue are not specified, the default environment returned by get_or_create_opencl_env() will be used along with its default queue.
If cl_env is not specified but a queue is specified, this queue will be used instead along with its associated context.
If both queue and cl_env are speficied, context should match. Allocator can be used to override cl_env.memory_pool and should also match context.
Note that allocation queue can be different from default array computation queue.
- absolute(x, out=None, queue=None, dtype=None)[source]¶
Calculate the absolute value element-wise, ouputs values as input type unless out or dtype is set.
- add(x1, x2, out=None, queue=None, dtype=None, name='add', **kwds)[source]¶
Add arguments element-wise.
- all(a, axis=None, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test whether all array elements along a given axis evaluate to True.
- allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Returns True if two arrays are element-wise equal within a tolerance.
- allequal(a, b, equal_nan=False, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Returns True if two arrays are element-wise equal within a tolerance.
- amax(a, axis=None, out=None, slice=None, queue=None, name='amax', **kwds)[source]¶
Return the maximum of an array.
- amin(a, axis=None, out=None, queue=None, name='amin', **kwds)[source]¶
Return the minimum of an array.
- any(a, axis=None, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test whether any array elements along a given axis evaluate to True.
- arctan2(x1, x2, out=None, queue=None, dtype=None)[source]¶
Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
- around(a, decimals=0, out=None, queue=None, dtype=None)[source]¶
Round an array to the given number of decimals.
- array(shape, dtype=<class 'numpy.float64'>, order=C_CONTIGUOUS(0), queue=None, min_alignment=None, buf=None, offset=0, strides=None, events=None)[source]¶
Create an OpenClArray, see pyopencl.array.Array constructor. If a queue is specified, it is set as default queue, else it will be backend.default_queue.
- array_equal(a1, a2, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
True if two arrays have the same shape and elements, False otherwise.
- asarray(a, queue=None, synchronize=True, dtype=None, order=C_CONTIGUOUS(0), array_queue=SAME_AS_TRANSFER(2))[source]¶
Convert the input to an OpenClArray. Queue is set as default queue.
- average(a, axis=None, weights=None, returned=False, queue=None)[source]¶
Compute the weighted average along the specified axis.
- binary_op(x0, x1, expr, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, output_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, convert_inputs=None, allocator=None, alloc_shapes=None, alloc_dtypes=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='binary_op', options=[], preamble='')[source]¶
- bitwise_and(x1, x2, out=None, queue=None, dtype=None)[source]¶
Compute the bit-wise AND of two arrays element-wise.
- bitwise_or(x1, x2, out=None, queue=None, dtype=None)[source]¶
Compute the bit-wise OR of two arrays element-wise.
- bitwise_xor(x1, x2, out=None, queue=None, dtype=None)[source]¶
Compute the bit-wise XOR of two arrays element-wise.
- static build_codegen_arguments(args, name, typegen, ctype, mesh_dim, known_vars, symbolic_mode, itype='ulong', const=False, ptr=True, volatile=False, **kargs)[source]¶
- can_wrap(handle)[source]¶
Should return True if handle is an Array or a array handle corresponding this backend.
- property cl_env¶
- clip(a, a_min, a_max, out=None, queue=None, dtype=None)[source]¶
Clip (limit) the values in an array.
- clip_components(a, a_min, a_max, out=None, queue=None, dtype=None)[source]¶
Clip (limit) the real and imaginary part of a complex number independantly. ie:
a.real = clip(a.real, a_min.real, a_max.real) a.imag = clip(a.imag, a_min.imag, a_max.imag)
- classmethod complex_fn(fname, handle)[source]¶
Return corresponding complex function name from pyopencl-complex.h matching handle complex datatype.
- property context¶
- convolve(a, v, mode='full', queue=None, dtype=None)[source]¶
Returns the discrete, linear convolution of two one-dimensional sequences.
- copysign(x1, x2, out=None, queue=None, dtype=None)[source]¶
Change the sign of x1 to that of x2, element-wise.
- copyto(dst, src, queue=None, synchronize=True, **kargs)[source]¶
src is a OpenClArray dst can be everything
- cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None)[source]¶
Return the cross product of two (arrays of) vectors.
- cumprod(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Return the cumulative product of elements along a given axis. /!precision loss because of operation ordering
- cumsum(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Return the cumulative sum of the elements along a given axis.
- property default_queue¶
- property device¶
- ediff1d(ary, to_end=None, to_begin=None)[source]¶
The differences between consecutive elements of an array.
- elementwise(ikargs, okargs, extra_kargs=None, input_arguments=None, output_arguments=None, extra_arguments=None, filter_expr=None, dtype=None, infer_dtype=False, queue=None, infer_queue=False, synchronize=True, convert_inputs=None, allocator=None, alloc_shapes=None, alloc_dtypes=None, Kernel=<class 'hysop.backend.device.opencl.opencl_array_backend._ElementwiseKernel'>, kernel_build_kwargs=None, kernel_call_kwargs=None, build_kernel_launcher=False)[source]¶
- Build and call kernel that takes:
n read-only scalars or OpenClArray as input arguments xi, m OpenClArray as output arguments yi, k read-only parameters pi
and performs an operation specified as a snippet of C99 on these arguments, depending on passed Kernel class and additional arguments passed in kernel_build_kwargs and kernel_call_kwargs.
- This method performs:
y0[i],…,ym[i] = f( x0[i],…,xn[i] ; p0,…,pk )
- Kernel arguments:
For all input and output arguments, if they are OpenClArray, all shapes and order should match or an error is raised.
If one of the output arg is set to None, it is allocated by the given allocator, dtype and queue with the global shape and order.
Allocation shape can be overidden by using the argument ‘alloc_shapes’ which should be a list of the same size as okargs (output arguments) or None. If alloc_shapes is not None at allocated variable index, this shape is used instead of the common operand shape.
If infer_dtype is set to True and dtype is None, every None output argument will be allocated with the first OpenClArray input dtype contained in ikargs (input arguments). If there is no input OpenClArray the lookup is extended to okargs (output arguments). This can be overhidden using alloc_dtypes witch should be a list of size of the output argument.
- Default arguments names (generated in opencl kernel) are:
x0,x1,…,xn for inputs ( ikargs -> input_arguments) y0,y1,…,ym for outputs ( okargs -> output_arguments) p0,p1,…,pk for parameters (extra_kargs -> extra_arguments)
input arguments and extra arguments are read-only.
input arguments (x0,…,xn) can be scalars or OpenClArrays. output arguments (y0,…,ym) can only be OpenClArrays. extra arguments (p0,…,pk) can be anything compatible with pyopencl.
- Expression filtering:
filter_expr is the dictionary of expr_name (str) -> expression (str) Expressions in filter_expr are filtered according the following rule:
If input xi is a scalar, elementwise access ‘x[i]’ is replaced by ‘x’ in given ‘expr’.
This allows broadcasting of scalars in operators.
Filtered expressions are added to kernel_build_kwargs entries prior to kernel construction. This implies that kernel_build_kwargs keys and filter_expr keys should not clash.
- Kernel build and kernel call:
- kernel creation:
knl = Kernel(**kernel_build_kwargs)
- kernel call:
knl(**kernel_call_kwargs)
- User supplied ‘kernel_build_kwargs’ are completed with:
all filtered expressions contained in dictionnary ‘filter_expr’
kernel_build_kwargs[‘context’] = context corresponding to queue
- kernel_build_kwargs[‘arguments’] = preprocessed arguments
(output+input+params)
kernel_build_kwargs[‘dtype’] = dtype
- User supplied ‘kernel_call_kwargs’ are completed with:
kernel_call_kwargs[‘queue’] = queue
kernel_call_kwargs[‘args’] = kargs (okargs+ikargs+extra_kargs), preprocessed.
kernel_call_kwargs[‘iargs’] = ikargs, preprocessed
kernel_call_kwargs[‘oargs’] = okargs, preprocessed, allocated if necessary
kernel_call_kwargs[‘pargs’] = extra_kargs, preprocessed
Preprocessed arguments are passed through self._prepare_args(…)
If there is a key clash in those dictionaries, the method will fail.
- Queue priorities:
queue (function argument), if infer_queue is set to True:
x0.default_queue, …, xn.default_queue y0.default_queue, …, ym.default_queue
/!default_cl_queue is not used in this function.
- Call and events:
wait_for specify a list a event to wait prior applying the kernel.
If synchronize is set, this is a blocking opencl call and this functions returns output arguments okargs as a tuple unless there is only one output.
If synchronize not set, this is a non blocking call and an event is returned in addition to the outputs as last argument.
The returned event may not be used for profiling purposes, because it only covers the last effective kernel call (reductions may use two kernels for example).
- empty(shape, dtype=<class 'numpy.float64'>, order=C_CONTIGUOUS(0), queue=None, min_alignment=None)[source]¶
Return a new array of given shape and type, without initializing entries. If queue is specified, the queue becomes the default queue, else backend.default_queue is used instead.
- empty_like(a, shape=None, dtype=None, order=None, subok=True, queue=None, min_alignment=None)[source]¶
Return a new array with the same shape and type as a given array. Queue is set as default queue.
- equal(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Return (x1 == x2) element-wise.
- exclusive_nanscan(kargs, neutral, scan_expr, input_expr='x0[i]', size=None, axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='exclusive_nanscan', options=[], preamble='')[source]¶
- exclusive_scan(kargs, neutral, scan_expr, input_expr='x0[i]', size=None, axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='exclusive_scan', options=[], preamble='')[source]¶
- exp(x, out=None, queue=None, dtype=None)[source]¶
Calculate the exponential of all elements in the input array.
- expm1(x, out=None, queue=None, dtype=None)[source]¶
Calculate exp(x) - 1 for all elements in the array.
- fabs(x, out=None, queue=None, dtype=None)[source]¶
Calculate the absolute value element-wise, outputs real values unless out or dtype is set.
- floor_divide(x1, x2, out=None, queue=None, dtype=None)[source]¶
Return the largest integer smaller or equal to the division of the inputs. Returns y = floor(x1/x2)
Special floating point values are handled this way:
x1 x2 output nan * nan * nan nan inf *** nan — inf 0 if (x1 and x2 have same sign) else -1 — — floor(x1/x2)
Note: inf means +inf or -inf.
- fmax(x1, x2, out=None, queue=None, dtype=None, name='_fmax')[source]¶
Element-wise maximum of array elements, ignoring NaNs.
- fmin(x1, x2, out=None, queue=None, dtype=None, name='_fmin', **kwds)[source]¶
Element-wise minimum of array elements, ignoring NaNs.
- fmod(x1, x2, out=None, queue=None, dtype=None)[source]¶
Return the element-wise remainder of division (REM). Remainder has the same sign as the dividend x1. This should not be confused with the Python modulus operator x1 % x2. Returns x - y*trunc(x/y)
- format_kernel_args(kargs, argprefix, argflags, argcast=None, dtype=None, is_output=False, arguments=None, const=False, filter_expr=None)[source]¶
- frexp(x, out1=None, out2=None, queue=None)[source]¶
Decompose the elements of x into mantissa and twos exponent.
- full(shape, fill_value, dtype=<class 'numpy.float64'>, order=C_CONTIGUOUS(0), queue=None, min_alignment=None)[source]¶
Return a new array of given shape and type, filled with fill_value. Queue is set as default queue.
- full_like(a, fill_value, dtype=None, order=None, subok=True, queue=None, min_alignment=None, shape=None)[source]¶
Return a new array with the same shape and type as a given array. Queue is set as default queue.
- generic_scan(kargs, neutral, scan_expr, output_statement, input_expr='x0[i]', size=None, is_segment_start_expr=None, input_fetch_exprs=None, axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, output_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, convert_inputs=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='generic_scan', options=[], preamble='')[source]¶
Scan arrays elements over the whole array. kargs = kernel array or scalar arguments (tuple)
- greater(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Return the truth value of (x1 > x2) element-wise.
- greater_equal(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Return the truth value of (x1 >= x2) element-wise.
- property host_array_backend¶
- hypot(x1, x2, out=None, queue=None, dtype=None)[source]¶
Given the legs of a right triangle, return its hypotenuse.
- i0(x, out=None, queue=None, dtype=None)[source]¶
Modified Bessel function of the first kind, order 0.
- inclusive_nanscan(kargs, neutral, scan_expr, input_expr='x0[i]', size=None, axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='inclusive_nanscan', options=[], preamble='')[source]¶
- inclusive_scan(kargs, neutral, scan_expr, input_expr='x0[i]', size=None, axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, convert_inputs=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='inclusive_scan', options=[], preamble='')[source]¶
- invert(x, out=None, queue=None, dtype=None)[source]¶
Compute bit-wise inversion, or bit-wise NOT, element-wise.
- isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Returns a boolean array where two arrays are element-wise equal within a tolerance.
- isfinite(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test element-wise for finiteness (not infinity or not Not a Number).
- isinf(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test element-wise for positive or negative infinity.
- isnan(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test element-wise for NaN and return result as a boolean array.
- isneginf(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test element-wise for negative infinity, return result as bool array.
- isposinf(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Test element-wise for positive infinity, return result as bool array.
- property kind¶
- left_shift(x1, x2, out=None, queue=None, dtype=None)[source]¶
Shift the bits of an integer to the left.
- less(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Return the truth value of (x1 < x2) element-wise.
- less_equal(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Return the truth value of (x1 =< x2) element-wise.
- log10(x, out=None, queue=None, dtype=None)[source]¶
Return the base 10 logarithm of the input array, element-wise.
- log1p(x, out=None, queue=None, dtype=None)[source]¶
Return the natural logarithm of one plus the input array, element-wise.
- logaddexp(x1, x2, out=None, queue=None, dtype=None)[source]¶
Logarithm of the sum of exponentiations of the inputs.
- logaddexp2(x1, x2, out=None, queue=None, dtype=None)[source]¶
Logarithm of the sum of exponentiations of the inputs in base-2.
- logical_and(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Compute the truth value of x1 AND x2 element-wise.
- logical_not(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Compute the truth value of NOT x element-wise.
- logical_or(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Compute the truth value of x1 OR x2 element-wise.
- logical_xor(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Compute the truth value of x1 XOR x2, element-wise.
- maximum(x1, x2, out=None, queue=None, dtype=None)[source]¶
Element-wise maximum of array elements, priority to NaNs.
- mean(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Compute the arithmetic mean along the specified axis.
- minimum(x1, x2, out=None, queue=None, dtype=None)[source]¶
Element-wise minimum of array elements, priority to NaNs.
- mod(x1, x2, out=None, queue=None, dtype=None)[source]¶
Return element-wise remainder of division (MOD). Remainder has the same sign as the divisor x2. Match Python modulus operator x1 % x2. Returns x - y*floor(x/y)
Special floating point values are handled this way:
x1 x2 output nan * nan * nan nan inf inf nan inf — x2 if (x1 and x2 have same sign) else x1 — — x1 - x2 * floor(x1/x2)
Note: inf means +inf or -inf.
- modf(x, out1=None, out2=None, queue=None, dtype=None)[source]¶
Return the fractional and integral parts of an array, element-wise. The fractional and integral parts are negative if the given number is negative. => they have the same sign as the input argument. out1 = fractional part out2 = integral part
- nan_to_num(x, out=None, queue=None, dtype=None)[source]¶
Replace nan with zero and inf with finite numbers.
- nancumprod(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one. /!precision loss because of operation ordering
- nancumsum(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Return the cumulative sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.
- nanmax(a, axis=None, out=None, slice=None, queue=None, name='nanmax', **kwds)[source]¶
Return the maximum of an array.
- nanmean(a, axis=None, dtype=None, out=None)[source]¶
Compute the arithmetic mean along the specified axis, ignoring NaNs.
- nanmedian(a, axis=None, out=None, overwrite_input=False)[source]¶
Compute the median along the specified axis, while ignoring NaNs.
- nanmin(a, axis=None, out=None, queue=None, name='nanmin', **kwds)[source]¶
Return the minimum of an array.
- nanprod(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones.
- nanreduce(kargs, neutral, reduce_expr, map_expr='x0[i]', axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, output_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, convert_inputs=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='nan_reduction', options=[], preamble='')[source]¶
Reduce arrays elements over the whole array, replacing mapped expr NaNs by the neutral. dtype should be a floating point type. kargs = kernel args as a scalar or tuple
- nanstd(a, axis=None, dtype=None, out=None, ddof=0)[source]¶
Compute the standard deviation along the specified axis, while ignoring NaNs.
- nansum(a, axis=None, dtype=None, out=None, queue=None, **kwds)[source]¶
Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zeros.
- nanvar(a, axis=None, dtype=None, out=None, ddof=0)[source]¶
Compute the variance along the specified axis, while ignoring NaNs.
- nary_op(ikargs, okargs, operation, extra_kargs=None, extra_arguments=None, input_arguments=None, output_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, alloc_shapes=None, alloc_dtypes=None, synchronize=True, wait_for=None, convert_inputs=None, build_kernel_launcher=False, name='nary_op', options=[], preamble='')[source]¶
A kernel that takes n vector as input and outputs m vectors. The operation is specified as a snippet of C99 on these arguments. Default arguments names are x0,x1,…,xn and y0,y1,…,ym.
- Queue priorities: queue (function argument),
- if infer_queue:
x0.default_queue, …, xn.default_queue, y0.default_queue, …, yn.default_queue,
For all input and output arguments, if they are OpenClArray, all shapes should match. If out is None, it is allocated to input shape with specified dtype.
y0[i] = f( x0[i],…,xn[i] ; p0,…,pk ) <=> y0[i] = ElementwiseKernel(const x0[i],…,const xn[i], const p0,…, const pk)
If synchronize is set to false, evt is returned as last argument. If out and dtype is None it is set to xi.dtype where xi is the first OpenClArray
options are opencl kernel build options. preamble is appended unmodified in source code before kernel declaration.
- not_equal(x1, x2, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Return (x1 != x2) element-wise.
- ones(shape, dtype=<class 'numpy.float64'>, order=C_CONTIGUOUS(0), queue=None, min_alignment=None)[source]¶
Return a new array of given shape and type, filled with ones. Queue is set as default queue.
- ones_like(a, dtype=None, order=None, subok=True, queue=None, min_alignment=None, shape=None)[source]¶
Return an array of ones with the same shape and type as a given array. Queue is set as default queue.
- power(x1, x2, out=None, queue=None, dtype=None)[source]¶
First array elements raised to powers from second array, element-wise.
- prod(a, axis=None, dtype=None, out=None, queue=None)[source]¶
Return the product of array elements over a given axis.
- rand(shape=None, queue=None, order=C_CONTIGUOUS(0), dtype=<class 'numpy.float64'>, out=None, a=0.0, b=1.0, generator=None)[source]¶
Return samples from the uniform distribution [a,b]. Default generator is clRandom.PhiloxGenerator.
- randn(shape=None, queue=None, order=C_CONTIGUOUS(0), dtype=<class 'numpy.float64'>, out=None, mu=0.0, sigma=1.0, generator=None, *args)[source]¶
Return samples from the standard normal distribution [mu,sigma]. Default generator is clRandom.PhiloxGenerator.
- real(val, queue=None, out=None, dtype=None)[source]¶
Return the real part of the elements of the array.
- real_if_close(a, tol=100, queue=None)[source]¶
If complex input returns a real array if complex parts are close to zero.
- reciprocal(x, out=None, queue=None, dtype=None)[source]¶
Return the reciprocal of the argument, element-wise.
- reduce(kargs, neutral, reduce_expr, map_expr='x0[i]', axis=None, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, output_arguments=None, convert_inputs=None, alloc_dtypes=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, allocator=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='reduction', options=[], preamble='')[source]¶
Reduce arrays elements over the whole array. kargs = kernel array or scalar arguments (tuple) y0 = ReductionKernel( MAP_EXPR(const x0[i],…,const xn[i], const p0,…, const pk) )
- reshape(a, newshape, order=C_CONTIGUOUS(0), **kargs)[source]¶
Gives a new shape to an array without changing its data.
- right_shift(x1, x2, out=None, queue=None, dtype=None)[source]¶
Shift the bits of an integer to the right.
- rint(x, out=None, queue=None, dtype=None)[source]¶
Round elements of the array to the nearest integer.
- sign(x, out=None, queue=None, dtype=None)[source]¶
Returns an element-wise indication of the sign of a number. NaNs values are kept to NaNs to comply with numpy.
- signbit(x, out=None, queue=None, dtype=<class 'numpy.uint8'>)[source]¶
Returns element-wise True where signbit is set (less than zero).
- sqrt(x, out=None, queue=None, dtype=None)[source]¶
Return the positive square-root of an array, element-wise.
- std(a, axis=None, dtype=None, out=None, ddof=0, queue=None)[source]¶
Compute the standard deviation along the specified axis.
- sum(a, axis=None, dtype=None, out=None, queue=None, **kwds)[source]¶
Sum of array elements over a given axis.
- transpose(a, axes=None)[source]¶
Permute the dimensions of an array (only array strides are permutated).
- trapz(y, x=None, dx=1.0, axis=-1)[source]¶
Integrate along the given axis using the composite trapezoidal rule.
- true_divide(x1, x2, out=None, queue=None, dtype=None)[source]¶
Returns a true division of the inputs, element-wise.
- trunc(x, out=None, queue=None, dtype=None)[source]¶
Return the truncated value of the input, element-wise.
- unary_op(x0, expr, out=None, extra_kargs=None, extra_arguments=None, input_arguments=None, output_arguments=None, dtype=None, infer_dtype=True, queue=None, infer_queue=True, convert_inputs=None, allocator=None, alloc_shapes=None, alloc_dtypes=None, synchronize=True, wait_for=None, build_kernel_launcher=False, name='unary_op', options=[], preamble='')[source]¶
- var(a, axis=None, dtype=None, out=None, ddof=0)[source]¶
Compute the variance along the specified axis.
- wrap(handle)[source]¶
Create an hysop.backend.device.OpenclArray from an pyopencl.array.Array instance.